<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>宽高自适应案例</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .layout {
            width: 1000px;
            height: 800px;
            background-color: #ccc;
            margin: 0 auto;
            /* 设置父容器为伸缩盒子 */
            display: flex;
            /* 默认主轴排列是row, 需要以列的方式排列 */
            flex-direction: column;
        }

        header {
            width: 100%;
            height: 100px;
            background-color: skyblue;
        }

        main {
            width: 100%;
            background-color: lightcoral;
            /* 让当前伸缩项占据父容器的剩余空间 */
            flex: 1;
            /* 让main容器称为伸缩盒子 */
            display: flex;
        }

        main > article {
            background-color: darkcyan;
            flex: 1;
        }

        main > aside {
            background-color: darkorchid;
            flex: 4;
        }

        footer {
            width: 100%;
            height: 80px;
            background-color: lightblue;
        }
    </style>
</head>
<body>
    <div class="layout">
        <header>header</header>
        <main>
            <article>article</article>
            <aside>aside</aside>
        </main>
        <footer>footer</footer>
    </div>
</body>
</html>